Use a class for CachedMapper-derived mappers instead of a dict#549
Merged
majosm merged 5 commits intoinducer:mainfrom Jan 28, 2025
Merged
Use a class for CachedMapper-derived mappers instead of a dict#549majosm merged 5 commits intoinducer:mainfrom
CachedMapper-derived mappers instead of a dict#549majosm merged 5 commits intoinducer:mainfrom
Conversation
a34936a to
378d439
Compare
This was referenced Sep 24, 2024
Merged
1cf2454 to
df7db39
Compare
d40153c to
e9b4ac5
Compare
c25dce2 to
7a556ad
Compare
majosm
commented
Jan 16, 2025
pytato/transform/__init__.py
Outdated
Comment on lines
331
to
310
| # FIXME: Figure out the right way to type annotate these | ||
| | tuple[CacheExprT, tuple[Any, ...], dict[str, Any]], |
Collaborator
Author
There was a problem hiding this comment.
How should I annotate the args tuple and kwargs dict here so that it matches *args: P.args, **kwargs: P.kwargs?
Owner
There was a problem hiding this comment.
a60b0f3 to
387bafb
Compare
inducer
reviewed
Jan 21, 2025
pytato/transform/__init__.py
Outdated
Comment on lines
331
to
310
| # FIXME: Figure out the right way to type annotate these | ||
| | tuple[CacheExprT, tuple[Any, ...], dict[str, Any]], |
Owner
There was a problem hiding this comment.
40b2a64 to
9cbe7f4
Compare
8546893 to
233c8e7
Compare
233c8e7 to
530f7e1
Compare
Collaborator
Author
|
Probably good for another look now. |
inducer
approved these changes
Jan 27, 2025
| self, | ||
| key_inputs: | ||
| CacheExprT | ||
| | tuple[CacheExprT, tuple[Any, ...], dict[str, Any]], |
Owner
There was a problem hiding this comment.
Link to the P-in-containers discussion to justify the Anys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds classes to represent the caches of
CachedMapper-derived mappers, which will be useful for adding array duplication checks and result deduplication (#550). Both of these features add additional cache dictionaries and cache retrieval/addition logic; this change minimizes the amount of logic that must be duplicated when mappers overriderec, as well as minimizes the extra arguments that need to be passed around for function caches when cloning new mappers.Depends on #531(merged).